﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if DOT_NET
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#endif
using StyleMVVM.DependencyInjection;
using StyleMVVM.UnitTests.TestClasses.GenericObjects;

namespace StyleMVVM.UnitTests.DependencyInjection
{
	[TestClass]
	public class GenericExportTests : BaseTestClass
	{
		[TestMethod]
		public void ConstraintsTest()
		{
			CombinedSimpleGenericInterface combined = Container.Locate<CombinedSimpleGenericInterface>();

			Assert.IsNotNull(combined);
			Assert.IsInstanceOfType(combined.DateTimeInterface, typeof(StructBasedSimpleGenericInterface<DateTime>));
			Assert.IsInstanceOfType(combined.StringIntreface, typeof(ClassBasedSimpleGenericInterface<string>));
		}

		[TestMethod]
		public void ConditionTest()
		{
			ImportConditionalGeneric1 generic1 = Container.Locate<ImportConditionalGeneric1>();

			Assert.IsNotNull(generic1);
			Assert.IsInstanceOfType(generic1.ImportConditionGeneric,typeof(ConditionalExport1<string>));

			ImportConditionalGeneric2 generic2 = Container.Locate<ImportConditionalGeneric2>();

			Assert.IsNotNull(generic2);
			Assert.IsInstanceOfType(generic2.ImportConditionGeneric,typeof(ConditionalExport2<string>));
		}
	}
}
